package com.briup.jz.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.briup.jz.bean.AccountApply;
import com.briup.jz.bean.Platform;
import com.briup.jz.bean.PlatformExample;
import com.briup.jz.bean.PlatformExample.Criteria;
import com.briup.jz.dao.PlatformMapper;
import com.briup.jz.service.IPlatformService;
import com.briup.jz.utils.CustomerException;
@Service
public class Platformlmpl implements IPlatformService {
 @Autowired
private PlatformMapper platformMapper;
	@Override
	public void saveOrUpdate(Platform platform) throws CustomerException {
		// TODO Auto-generated method stub
		if(platform.getId()!=null)
		{
			platformMapper.updateByPrimaryKey(platform);
		}
		platformMapper.insert(platform);
	}

	@Override
	public List<Platform> query(String card) {
		// TODO Auto-generated method stub
		PlatformExample example=new PlatformExample();
		Criteria criteria=example.createCriteria();
		if(card!=null)
		{
			criteria.andBankCardLike("%"+card+"%");
		}
		
		return platformMapper.selectByExample(example);
	}

	@Override
	public void deleteById(long id) throws CustomerException {
		// TODO Auto-generated method stub
	Platform platform=platformMapper.selectByPrimaryKey(id);
		if(platform!=null )
		{
			platformMapper.deleteByPrimaryKey(id);
		}else
		{
	throw new CustomerException("要删除的分类信息不存在");
		}
	}
	}

